import { useSelector, useDispatch } from 'react-redux'
import { changeGlobalValue } from '@/store/modules/core'
import DataEntry from '../../components/DataEntry'
import globalConfig from './global'

const Global = () => {
  const dispatch = useDispatch()
  const globalValue = useSelector((state) => state.core.globalValue)

  const onChange = (dataEntryValue) => {
    dispatch(changeGlobalValue(dataEntryValue))
  }

  return <DataEntry configs={globalConfig} value={globalValue} onChange={onChange} />
}

export default Global
